//
//  STMutableCopyController.swift
//  iPhone
//
//  Created by Toj on 4/10/23.
//

import Foundation

// MARK: - 懒加载(属性), 变量, 初始化init
class STMutableCopyController: STBaseViewController {
    
}

// MARK: - 生命周期
extension STMutableCopyController {
    
    override func viewDidLoad() {
        super.viewDidLoad()
        
        setupMakeInitialize()
        setupMakeAddSubviews()
        setupMakeLayoutSubviews()
    }
}

// MARK: - 初始化设置
private extension STMutableCopyController {
    
    func setupMakeAddSubviews() {
        
    }
    
    func setupMakeLayoutSubviews() {
        
    }
    
    func setupMakeInitialize() {
        let ad = TSAdModel()
        ad.name = "admob 测试广告"
        ad.outer_id = "123"
        ad.view_duration = 0
        // 策略id
        ad.space_id = "456"
        // 广告位id
        ad.position_id = "789"
        // 物料
        ad.materials = "qwertyuiopasdfghjk"
        // 跳转链接
        ad.link = "home.com"
        
        print("-->toj: \(ad.cm_objectAddress)")
        
        guard let nad = ad.mutableCopy() as? TSAdModel else { return }
        print("-->toj: \(nad.cm_objectAddress)")
    }
}

class TSAdModel: NSObject, NSMutableCopying {
    
    var name = ""
    var outer_id = ""
    var view_duration = 0
    // 策略id
    var space_id = ""
    // 广告位id
    var position_id = ""
    // 物料
    var materials = ""
    // 跳转链接
    var link = ""
    
    func mutableCopy(with zone: NSZone? = nil) -> Any {
       return self
    }
}
